using System.Collections.Generic;
using System.ServiceModel.Syndication;
using aprogblog.Domain;
using aprogblog.Domain.Helpers;

namespace aprogblog.Specs.Helpers {

    public static class Actors {
    
        public const string TheExpectedEntryId = "42";
    
        public static Entry Entry(string Id) { return new Entry {
            Id = Id,
            Title = "Entry " + Id,
            Description = "It's " + Id
        };}
        
        public static Entry TheExpectedEntry { get { return 
            Entry(TheExpectedEntryId)
        ;}}

        public static SyndicationItem Item(string Id) { 
            return Entry(Id).ToItem();
        }

        public static List<Entry> ThreeEntries { get { return new List<Entry> {
            Entry("1"), Entry("2"), Entry("3")
        };}}

        public static SyndicationFeed FeedWithTwoItems { get { return 
            Feed("0", "1")
        ;}}

        public static SyndicationFeed FeedWithTheExpectedEntry { get { return
            Feed("0", TheExpectedEntryId, "1")
        ;}}

        public static SyndicationFeed Feed(params string[] ItemIds) {
            var Items = new List<SyndicationItem>();
            
            ItemIds.ForEach(ItemId => Items.Add(Item(ItemId)));
            
            return new SyndicationFeed { Items = Items };
        }
    }
}